package com.hymall.service.wx;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hymall.bean.MarketBrand;
import com.hymall.bean.MarketBrandExample;
import com.hymall.bean.common.BasePageInfo;
import com.hymall.bean.common.CommonData;
import com.hymall.mapper.MarketBrandMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 长平居士 - rolfcui@outlook.com
 * @description 微信 商场管理 品牌制造商 服务实现
 * @date 2022/7/19 14:22
 */
@Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    MarketBrandMapper marketBrandMapper;

    @Override
    public CommonData<MarketBrand> query(BasePageInfo info) {
        PageHelper.startPage(info.getPage(), info.getLimit());
        MarketBrandExample example = new MarketBrandExample();
        List<MarketBrand> list = marketBrandMapper.selectByExample(example);
        PageInfo<MarketBrand> pageInfo = new PageInfo<>(list);
        return CommonData.data(pageInfo);
    }

    @Override
    public MarketBrand detail(Integer id) {
        MarketBrand marketBrand = marketBrandMapper.selectByPrimaryKey(id);
        return marketBrand;
    }

}
